package day09_charset_io.com.itheima.d2_byte_stream;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Demo3_FileInputStream {
    public static void main(String[] args) throws IOException {
        FileInputStream is = new FileInputStream("d:\\a.txt");
        File file = new File("");
        long length = file.length();
        System.out.println("length = " + length);
        byte[] bytes = new byte[(int) length];

        int len2 = is.read(bytes);
        System.out.println("----------------------");

        byte[] buffer1 = is.readAllBytes();
        String rs2 = new String(buffer1);
        System.out.println("rs2 = " + rs2);
    }
}
